package com.abbas.CayTcore.dao

import androidx.room.*
import com.abbas.CayTcore.entity.TCoreBase
import io.reactivex.Single

@Dao
interface CoreDao {

    @Query("SELECT * FROM tCore")
    fun getAll(): Single<List<TCoreBase>>

    @Query("SELECT * FROM tCore WHERE length = :l AND width = :w")
    fun getLWOfCore(l: Int,w: Int): Single<List<TCoreBase>>

    @Insert
    fun insert(vararg core: TCoreBase) :List<Long>

    @Update
    fun updateCore(vararg cores: TCoreBase): Int

    @Query("SELECT * FROM tCore WHERE _id = :coreId")
    fun getCoreOfId(coreId: Int) :Single<TCoreBase>
//    @Insert
//    fun insert(vararg core: TCoreBase): Completable

    @Delete
    fun deleteCore(core: TCoreBase): Int

}